package com.example.m3;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Scanner;


@Component
public class Producer {
    @Autowired
    private AmqpTemplate t;
    // 自定义的方法，需要自己手动调用，完成发送
    public void send() {
        while (true) {
            System.out.print("输入消息： ");
            String s = new Scanner(System.in).nextLine();
            t.convertAndSend("logs", "", s);
        }
    }
}
